pub trait Program: Sized {
type State;
type Message: Send + Debug + 'static;
type Theme: Default + DefaultStyle;
type Renderer: Renderer;
type Executor: Executor;
// Required methods
fn update(
&self,
state: &mut Self::State,
message: Self::Message,
) -> Task<Self::Message>;
fn view<'a>(
&self,
state: &'a Self::State,
window: Id,
) -> Element<'a, Self::Message, Self::Theme, Self::Renderer>;
// Provided methods
fn title(&self, _state: &Self::State, _window: Id) -> String { ... }
fn subscription(&self, _state: &Self::State) -> Subscription<Self::Message> { ... }
fn theme(&self, _state: &Self::State, _window: Id) -> Self::Theme { ... }
fn style(&self, _state: &Self::State, theme: &Self::Theme) -> Appearance { ... }
fn scale_factor(&self, _state: &Self::State, _window: Id) -> f64 { ... }
fn run(
self,
settings: Settings,
window_settings: Option<Settings>,
) -> Result<(), Error>
where Self: 'static,
Self::State: Default { ... }
fn run_with<I>(
self,
settings: Settings,
window_settings: Option<Settings>,
initialize: I,
) -> Result<(), Error>
where Self: 'static,
I: FnOnce() -> (Self::State, Task<Self::Message>) + 'static { ... }
}
Expand description
Required Associated Types§
sourcetype Theme: Default + DefaultStyle
type Theme: Default + DefaultStyle
The theme of the program.
Required Methods§
fn update( &self, state: &mut Self::State, message: Self::Message, ) -> Task<Self::Message>
fn view<'a>( &self, state: &'a Self::State, window: Id, ) -> Element<'a, Self::Message, Self::Theme, Self::Renderer>
Provided Methods§
fn title(&self, _state: &Self::State, _window: Id) -> String
fn subscription(&self, _state: &Self::State) -> Subscription<Self::Message>
fn theme(&self, _state: &Self::State, _window: Id) -> Self::Theme
fn style(&self, _state: &Self::State, theme: &Self::Theme) -> Appearance
fn scale_factor(&self, _state: &Self::State, _window: Id) -> f64
Object Safety§
This trait is not object safe.