[][src]Type Definition kayrx_ui::fabric::state::Reducer

type Reducer<State, Action> = fn(_: &State, _: &Action) -> State;

Function signature for a reducer.

Example

enum Action {
    Increment,
    Decrement
}

let reducer: Reducer<u8, Action> = |state: &u8, action: &Action| -> u8 {
    match action {
        Action::Increment => state + 1,
        Action::Decrement => state - 1
    }
};