relm4::shared_state

Trait Reducible

source
pub trait Reducible {
    type Input;

    // Required methods
    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§

source

type Input

The input message type used to modify the data.

Required Methods§

source

fn init() -> Self

Initialize the data.

source

fn reduce(&mut self, input: Self::Input) -> bool

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.

Object Safety§

This trait is not object safe.

Implementors§