pub trait App {
type Event: Unpin + Send + 'static;
type Model;
type ViewModel;
type Effect: Effect + Unpin;
// Required methods
fn update(
&self,
event: Self::Event,
model: &mut Self::Model,
) -> Command<Self::Effect, Self::Event>;
fn view(&self, model: &Self::Model) -> Self::ViewModel;
}Expand description
Required Associated Types§
Sourcetype Event: Unpin + Send + 'static
type Event: Unpin + Send + 'static
Event, typically an enum, defines the actions that can be taken to update the application state.
Required Methods§
Sourcefn update(
&self,
event: Self::Event,
model: &mut Self::Model,
) -> Command<Self::Effect, Self::Event>
fn update( &self, event: Self::Event, model: &mut Self::Model, ) -> Command<Self::Effect, Self::Event>
Update method defines the transition from one model state to another in response to an event.
update may mutate the model and returns a Command describing
the managed side-effects to perform as a result of the event. Commands are constructed by
capabilities, and combined to run sequentially or concurrently. If an event requires no
side-effects, return Command::done.
Typically, update should call at least render.