[−][src]Macro kayrx_ui::combine_reducers
Combines multiple reducers into a single one.
The first one gets called first, chained into the second one and so on...
Usage
let reducer: Reducer<State, Action> = combine_reducers!(State, &Action, first_reducer, second_reducer, third_reducer);
(State
and Action
being the actual types.)
Example
enum Action { Increment, Decrement } fn counter_reducer(state: &u8, action: &Action) -> u8 { match action { Action::Increment => state + 1, Action::Decrement => state - 1 } } fn add_two_reducer(state: &u8, _: &Action) -> u8 { state + 2 } fn main() { let reducer: Reducer<u8, Action> = combine_reducers!(u8, &Action, counter_reducer, add_two_reducer); }