pub trait Update{
type Model;
type ModelParam: Sized;
type Msg;
// Required methods
fn model(relm: &Relm<Self>, param: Self::ModelParam) -> Self::Model;
fn update(&mut self, event: Self::Msg);
// Provided method
fn subscriptions(&mut self, _relm: &Relm<Self>) { ... }
}Expand description
Trait for a basic (non-widget) component.
A component has a model (data) associated with it and can mutate it when it receives a message
(in the update() method).
Required Associated Types§
Sourcetype ModelParam: Sized
type ModelParam: Sized
The type of the parameter of the model() function used to initialize the model.
Required Methods§
Sourcefn model(relm: &Relm<Self>, param: Self::ModelParam) -> Self::Model
fn model(relm: &Relm<Self>, param: Self::ModelParam) -> Self::Model
Create the initial model.
Provided Methods§
Sourcefn subscriptions(&mut self, _relm: &Relm<Self>)
fn subscriptions(&mut self, _relm: &Relm<Self>)
Connect the subscriptions.
Subscriptions are Future/Stream that are spawn when the object is created.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".