Trait relm4::Reducible

source ·
pub trait Reducible {
    type Input;

    fn init() -> Self;
    fn reduce(&mut self, input: Self::Input) -> bool;
}
Expand description

A trait that implements a reducer function.

For more information, see Reducer.

Required Associated Types§

The input message type used to modify the data.

Required Methods§

Initialize the data.

Process the input message and update the state.

Return true to notify all subscribers. Return false to ignore all subscribers.

For example, it makes sense to return false to indicate that the message had no (noteworthy) effect on the data and the subscribers don’t need to be notified.

Implementors§