Skip to main content

EffectStoreLike

Trait EffectStoreLike 

Source
pub trait EffectStoreLike<S, A: Action, E> {
    // Required methods
    fn dispatch(&mut self, action: A) -> ReducerResult<E>;
    fn state(&self) -> &S;

    // Provided method
    fn try_dispatch(
        &mut self,
        action: A,
    ) -> Result<ReducerResult<E>, DispatchError> { ... }
}
Expand description

Effect store interface used by EffectRuntime.

Required Methods§

Source

fn dispatch(&mut self, action: A) -> ReducerResult<E>

Dispatch an action and return state changes plus effects.

Source

fn state(&self) -> &S

Get the current state.

Provided Methods§

Source

fn try_dispatch(&mut self, action: A) -> Result<ReducerResult<E>, DispatchError>

Dispatch an action and return state changes plus effects.

Default behavior wraps Self::dispatch in Ok(...).

Implementors§

Source§

impl<S, A: Action, E> EffectStoreLike<S, A, E> for EffectStore<S, A, E>

Source§

impl<S, A: Action, E, M: Middleware<S, A>> EffectStoreLike<S, A, E> for EffectStoreWithMiddleware<S, A, E, M>