pub trait Program: Sized {
type State;
type Message: Send + Debug + 'static;
type Theme: Default + Base;
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) -> Style { ... }
fn scale_factor(&self, _state: &Self::State, _window: Id) -> f64 { ... }
fn run(
self,
settings: Settings,
window_settings: Option<Settings>,
) -> Result
where Self: 'static,
Self::State: Default { ... }
fn run_with<I>(
self,
settings: Settings,
window_settings: Option<Settings>,
initialize: I,
) -> Result
where Self: 'static,
I: FnOnce() -> (Self::State, Task<Self::Message>) + 'static { ... }
}
Expand description
Required Associated Types§
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) -> Style
fn scale_factor(&self, _state: &Self::State, _window: Id) -> f64
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.