pub struct Store<State, Action, RootReducer> where
    State: Send,
    RootReducer: Send
{ /* private fields */ }
Expand description

The store is the heart of any redux application, it contains the state of the application.

The state of the store can be modified by dispatching actions to it. Updates to the state can be observed by subscribing to the store or by writing middleware. Getting a part of the store or the full store is possible with the select and state_cloned methods.

Implementations

Create a new store with the given root reducer and default state

Create a new store with the given root reducer and the provided state

Dispatch a new action to the store

Notice that this method takes &self and not &mut self, this enables us to dispatch actions from multiple places at once without requiring locks.

Select a part of the state, this is more efficient than copying the entire state all the time. In case you still need a full copy of the state, use the state_cloned method.

Returns a cloned version of the state. This is not efficient, if you only need a part of the state use select instead

Subscribe to state changes. Every time an action is dispatched the subscriber will be notified after the state is updated

Wrap the store with middleware, see middleware module for more examples

Trait Implementations

Dispatch a new action to the store Read more

Select a part of the state, this is more efficient than copying the entire state all the time. In case you still need a full copy of the state, use the state_cloned method. Read more

Returns a cloned version of the state. This is not efficient, if you only need a part of the state use select instead Read more

Subscribe to state changes. Every time an action is dispatched the subscriber will be notified after the state is updated Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.