Trait relm4::MessageHandler
source · pub trait MessageHandler<ParentModel: Model> {
type Msg;
type Sender;
// Required methods
fn init(
parent_model: &ParentModel,
parent_sender: Sender<ParentModel::Msg>
) -> Self;
fn send(&self, msg: Self::Msg);
fn sender(&self) -> Self::Sender;
}
Expand description
A message handler that can be used in situations where a RelmWorker
isn’t flexible enough.
Required Associated Types§
sourcetype Sender
type Sender
The sender type that can be used to send a message to a RelmMsgHandler
.
Required Methods§
sourcefn init(
parent_model: &ParentModel,
parent_sender: Sender<ParentModel::Msg>
) -> Self
fn init( parent_model: &ParentModel, parent_sender: Sender<ParentModel::Msg> ) -> Self
Initialize this message handler.
sourcefn sender(&self) -> Self::Sender
fn sender(&self) -> Self::Sender
Get a sender for sending messages to this RelmMsgHandler
.