Skip to main content

DispatchStore

Trait DispatchStore 

Source
pub trait DispatchStore<S, A>
where A: Action,
{ // Required methods fn dispatch(&mut self, action: A) -> bool; fn state(&self) -> &S; // Provided method fn try_dispatch(&mut self, action: A) -> Result<bool, DispatchError> { ... } }
Expand description

Store interface used by DispatchRuntime.

Required Methods§

Source

fn dispatch(&mut self, action: A) -> bool

Dispatch an action and return whether the state changed.

Source

fn state(&self) -> &S

Get the current state.

Provided Methods§

Source

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

Dispatch an action and return whether the state changed.

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

Implementors§

Source§

impl<S, A> DispatchStore<S, A> for Store<S, A>
where A: Action,

Source§

impl<S, A, M> DispatchStore<S, A> for StoreWithMiddleware<S, A, M>
where A: Action, M: Middleware<S, A>,