Skip to main content

Reducer

Trait Reducer 

Source
pub trait Reducer {
    type State;
    type Action;

    // Required method
    fn reduce(
        &self,
        state: &mut Self::State,
        action: Self::Action,
    ) -> Cmd<Self::Action>;
}
Expand description

Composable update logic (UDF Reducer parity).

Required Associated Types§

Required Methods§

Source

fn reduce( &self, state: &mut Self::State, action: Self::Action, ) -> Cmd<Self::Action>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<S, A> Reducer for fn(&mut S, A) -> Cmd<A>

Blanket impl — existing update fn pointers are reducers (zero-cost hot path).

Source§

type State = S

Source§

type Action = A

Source§

fn reduce(&self, state: &mut S, action: A) -> Cmd<A>

Implementors§

Source§

impl<R, F, S, A> Reducer for CatchReducer<R, F>
where R: Reducer<State = S, Action = A>, F: Fn(SafeReduceError) -> Cmd<A>,

Source§

type State = S

Source§

type Action = A

Source§

impl<R, F, S, A> Reducer for RollbackCatchReducer<R, F, S>
where R: Reducer<State = S, Action = A>, S: Clone, F: Fn(SafeReduceError) -> Cmd<A>,

Source§

type State = S

Source§

type Action = A

Source§

impl<R, PS, PA, CS, CA, Id> Reducer for ForEachReducer<R, PS, PA, CS, CA, Id>
where R: Reducer<State = CS, Action = CA>, CS: Identifiable<Id = Id>, Id: Copy + Eq + Hash + Send + Sync + 'static, PA: Clone + Send + 'static, CA: Send + 'static,

Source§

type State = PS

Source§

type Action = PA

Source§

impl<R, PS: 'static, PA, CS: 'static, CA, AK, SK> Reducer for IfLetReducer<R, PS, PA, CS, CA, AK, SK>
where R: Reducer<State = CS, Action = CA>, PA: Clone + Send + 'static, CA: Clone + Send + 'static, AK: Casepath<PA, CA> + Clone + Send + Sync + 'static, SK: RefKpTrait<PS, CS>,

Source§

type State = PS

Source§

type Action = PA

Source§

impl<R, PS: 'static, PA, CS: 'static, CA, AK, SK> Reducer for ScopeReducer<R, PS, PA, CS, CA, AK, SK>
where R: Reducer<State = CS, Action = CA>, PA: Send + 'static, CA: Clone + Send + 'static, AK: Casepath<PA, CA> + Clone + Send + Sync + 'static, SK: RefKpTrait<PS, CS>,

Source§

type State = PS

Source§

type Action = PA

Source§

impl<S, A, R1, R2, R3, R4, R5, R6> Reducer for CombineReducers<(R1, R2, R3, R4, R5, R6)>
where R1: Reducer<State = S, Action = A>, R2: Reducer<State = S, Action = A>, R3: Reducer<State = S, Action = A>, R4: Reducer<State = S, Action = A>, R5: Reducer<State = S, Action = A>, R6: Reducer<State = S, Action = A>, A: Clone,

Source§

type State = S

Source§

type Action = A

Source§

impl<S, A, R1, R2, R3, R4, R5> Reducer for CombineReducers<(R1, R2, R3, R4, R5)>
where R1: Reducer<State = S, Action = A>, R2: Reducer<State = S, Action = A>, R3: Reducer<State = S, Action = A>, R4: Reducer<State = S, Action = A>, R5: Reducer<State = S, Action = A>, A: Clone,

Source§

type State = S

Source§

type Action = A

Source§

impl<S, A, R1, R2, R3, R4> Reducer for CombineReducers<(R1, R2, R3, R4)>
where R1: Reducer<State = S, Action = A>, R2: Reducer<State = S, Action = A>, R3: Reducer<State = S, Action = A>, R4: Reducer<State = S, Action = A>, A: Clone,

Source§

type State = S

Source§

type Action = A

Source§

impl<S, A, R1, R2, R3> Reducer for CombineReducers<(R1, R2, R3)>
where R1: Reducer<State = S, Action = A>, R2: Reducer<State = S, Action = A>, R3: Reducer<State = S, Action = A>, A: Clone,

Source§

type State = S

Source§

type Action = A

Source§

impl<S, A, R1, R2> Reducer for CombineReducers<(R1, R2)>
where R1: Reducer<State = S, Action = A>, R2: Reducer<State = S, Action = A>, A: Clone,

Source§

type State = S

Source§

type Action = A

Source§

impl<S, A, R1> Reducer for CombineReducers<(R1,)>
where R1: Reducer<State = S, Action = A>, A: Clone,

Source§

type State = S

Source§

type Action = A

Source§

impl<S, A> Reducer for Reduce<S, A>

Source§

type State = S

Source§

type Action = A