pub trait MobilerApp: Default {
type Event: Serialize + DeserializeOwned + Send + 'static;
type Model: Default;
// Required methods
fn update(
&self,
event: Self::Event,
model: &mut Self::Model,
cx: &mut Cx<Self::Event>,
);
fn view(&self, model: &Self::Model) -> Widget;
// Provided methods
fn input(
&self,
id: &str,
value: InputValue,
model: &mut Self::Model,
cx: &mut Cx<Self::Event>,
) { ... }
fn restore(&self, data: &str, model: &mut Self::Model) { ... }
}Expand description
What a Mobiler app implements. Write typed domain events; Mobiler serializes them into opaque tokens behind the scenes.
Required Associated Types§
Required Methods§
fn update( &self, event: Self::Event, model: &mut Self::Model, cx: &mut Cx<Self::Event>, )
fn view(&self, model: &Self::Model) -> Widget
Provided Methods§
fn input( &self, id: &str, value: InputValue, model: &mut Self::Model, cx: &mut Cx<Self::Event>, )
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".