[go: up one dir, main page]

Application

Trait Application 

Source
pub trait Application {
    // Required method
    fn new(ctx: &mut Context) -> impl Future<Output = impl Drawable>;

    // Provided methods
    fn services() -> ServiceList { ... }
    fn plugins(_ctx: &mut Context) -> Vec<Box<dyn Plugin>> { ... }
}
Expand description

The core application trait.

An Application provides services, registers plugins, and defines the entrypoint for creating the root Drawable of the app.

§Example

struct MyApp;

impl Application for MyApp {
    async fn new(ctx: &mut Context) -> Box<dyn Drawable> {
        Box::new(MyRootDrawable::new())
    }
}

Required Methods§

Source

fn new(ctx: &mut Context) -> impl Future<Output = impl Drawable>

Provided Methods§

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.

Implementors§