Skip to main content

RuntimeStore

Trait RuntimeStore 

Source
pub trait RuntimeStore<S, A: Action, E = NoEffect> {
    // 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

Store interface used by Runtime.

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> RuntimeStore<S, A, E> for Store<S, A, E>

Source§

impl<S, A: Action, E, M: Middleware<S, A>> RuntimeStore<S, A, E> for StoreWithMiddleware<S, A, E, M>