Application

Trait Application 

Source
pub trait Application: Sized {
    type Theme: Theme;
    type Graphics: VectorGraphicsInterface;
    type State;

    // Required methods
    fn build(context: AppContext, state: Self::State) -> impl Widget;
    fn config(&self) -> MayConfig<Self::Theme, Self::Graphics>;

    // Provided methods
    fn plugins(&self) -> PluginManager<Self::Theme, Self::Graphics> { ... }
    fn init(&self) { ... }
    fn run(self, state: Self::State) { ... }
}
Expand description

The main application interface.

Contains basic functions for the MayRunner to create and run an application.

Required Associated Types§

Source

type Theme: Theme

The theme of the application and its widgets.

See maycoon_theme::theme for built-in themes.

Source

type Graphics: VectorGraphicsInterface

The vector graphics interface to use for rendering.

See VectorGraphicsInterface for more.

Source

type State

The global state of the application.

Required Methods§

Source

fn build(context: AppContext, state: Self::State) -> impl Widget

Renders/builds the application’s widgets.

This function will be passed to the MayRunner to create and run the application.

Source

fn config(&self) -> MayConfig<Self::Theme, Self::Graphics>

Returns the MayConfig for the application.

Provided Methods§

Source

fn plugins(&self) -> PluginManager<Self::Theme, Self::Graphics>

Builds and returns the PluginManager for the application.

Source

fn init(&self)

Initializes the backend application data.

This function is called before the actual launch of the app.

The default implementation just initializes the task runner.

Source

fn run(self, state: Self::State)

Runs the application using the MayRunner.

Override this method if you want to use a custom event loop.

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§