Trait iced::program::Definition

source ·
pub trait Definition: Sized {
    type State;
    type Message: Send + Debug;
    type Theme: Default + DefaultStyle;
    type Renderer: Renderer;
    type Executor: Executor;

    // Required methods
    fn load(&self) -> Command<Self::Message>;
    fn update(
        &self,
        state: &mut Self::State,
        message: Self::Message
    ) -> Command<Self::Message>;
    fn view<'a>(
        &self,
        state: &'a Self::State
    ) -> Element<'a, Self::Message, Self::Theme, Self::Renderer>;

    // Provided methods
    fn title(&self, _state: &Self::State) -> String { ... }
    fn subscription(&self, _state: &Self::State) -> Subscription<Self::Message> { ... }
    fn theme(&self, _state: &Self::State) -> Self::Theme { ... }
    fn style(&self, _state: &Self::State, theme: &Self::Theme) -> Appearance { ... }
}
Expand description

The internal definition of a Program.

You should not need to implement this trait directly. Instead, use the methods available in the Program struct.

Required Associated Types§

source

type State

The state of the program.

source

type Message: Send + Debug

The message of the program.

source

type Theme: Default + DefaultStyle

The theme of the program.

source

type Renderer: Renderer

The renderer of the program.

source

type Executor: Executor

The executor of the program.

Required Methods§

source

fn load(&self) -> Command<Self::Message>

source

fn update( &self, state: &mut Self::State, message: Self::Message ) -> Command<Self::Message>

source

fn view<'a>( &self, state: &'a Self::State ) -> Element<'a, Self::Message, Self::Theme, Self::Renderer>

Provided Methods§

source

fn title(&self, _state: &Self::State) -> String

source

fn subscription(&self, _state: &Self::State) -> Subscription<Self::Message>

source

fn theme(&self, _state: &Self::State) -> Self::Theme

source

fn style(&self, _state: &Self::State, theme: &Self::Theme) -> Appearance

Object Safety§

This trait is not object safe.

Implementors§