cosmic::iced_winit::runtime::multi_window::program

Trait Program

source
pub trait Program: Sized {
    type Renderer: Renderer + Renderer;
    type Message: Debug + Send;
    type Theme;

    // Required methods
    fn update(&mut self, message: Self::Message) -> Task<Self::Message>;
    fn view(
        &self,
        window: Id,
    ) -> Element<'_, Self::Message, Self::Theme, Self::Renderer>;
}
Expand description

The core of a user interface for a multi-window application following The Elm Architecture.

Required Associated Types§

source

type Renderer: Renderer + Renderer

The graphics backend to use to draw the Program.

source

type Message: Debug + Send

The type of messages your Program will produce.

source

type Theme

The theme used to draw the Program.

Required Methods§

source

fn update(&mut self, message: Self::Message) -> Task<Self::Message>

Handles a message and updates the state of the Program.

This is where you define your update logic. All the messages, produced by either user interactions or commands, will be handled by this method.

Any Task returned will be executed immediately in the background by the runtime.

source

fn view( &self, window: Id, ) -> Element<'_, Self::Message, Self::Theme, Self::Renderer>

Returns the widgets to display in the Program for the window.

These widgets can produce messages based on user interaction.

Object Safety§

This trait is not object safe.

Implementors§