pub struct StoreRef<State, Action, Event, Effect>(/* private fields */);
Expand description
Implementations§
Methods from Deref<Target = Store<State, Action, Event, Effect>>§
Sourcepub fn state(&self) -> Rc<State>
pub fn state(&self) -> Rc<State>
Get the current State
stored in this store.
Modifications to this state need to be performed by
dispatching an Action
to the store using
dispatch().
Sourcepub fn dispatch<A: Into<Action>>(&self, action: A)
pub fn dispatch<A: Into<Action>>(&self, action: A)
Dispatch an Action
to be passed to the Reducer in order to
modify the State
in this store, and produce Events
to be
sent to the store listeners.
Sourcepub fn subscribe<L: AsListener<State, Event>>(&self, listener: L)
pub fn subscribe<L: AsListener<State, Event>>(&self, listener: L)
Subscribe a Listener to changes in the store state and
events produced by the Reducer as a result of Action
s
dispatched via dispatch().
The listener is a weak reference; when the strong reference associated with it (usually Callback) is dropped, the listener will be removed from this store upon dispatch().
If you want to subscribe to state changes associated with
specific Event
s, see
subscribe_event() or
subscribe_event()
Sourcepub fn subscribe_event<L: AsListener<State, Event>>(
&self,
listener: L,
event: Event,
)
pub fn subscribe_event<L: AsListener<State, Event>>( &self, listener: L, event: Event, )
Subscribe a Listener to changes in the store state and
events produced by the Reducer as a result of Action
s
being dispatched via dispatch() and
reduced with the store’s Reducer. This subscription is only
active changes which produce the specific matching event
from the Reducer.
The listener is a weak reference; when the strong reference associated with it (usually Callback) is dropped, the listener will be removed from this store upon dispatch().
Sourcepub fn subscribe_events<L: AsListener<State, Event>, E: IntoIterator<Item = Event>>(
&self,
listener: L,
events: E,
)
pub fn subscribe_events<L: AsListener<State, Event>, E: IntoIterator<Item = Event>>( &self, listener: L, events: E, )
Subscribe a Listener to changes in the store state and
events produced by the Reducer as a result of Action
s
being dispatched via dispatch() and
reduced with the store’s Reducer. This subscription is only
active changes which produce any of the specific matching
events
from the Reducer.
The listener is a weak reference; when the strong reference associated with it (usually Callback) is dropped, the listener will be removed from this store upon dispatch().
Sourcepub fn add_middleware<M: Middleware<State, Action, Event, Effect> + 'static>(
&self,
middleware: M,
)
pub fn add_middleware<M: Middleware<State, Action, Event, Effect> + 'static>( &self, middleware: M, )
Add Middleware to modify the behaviour of this Store during a dispatch().
Trait Implementations§
Auto Trait Implementations§
impl<State, Action, Event, Effect> Freeze for StoreRef<State, Action, Event, Effect>
impl<State, Action, Event, Effect> !RefUnwindSafe for StoreRef<State, Action, Event, Effect>
impl<State, Action, Event, Effect> !Send for StoreRef<State, Action, Event, Effect>
impl<State, Action, Event, Effect> !Sync for StoreRef<State, Action, Event, Effect>
impl<State, Action, Event, Effect> Unpin for StoreRef<State, Action, Event, Effect>
impl<State, Action, Event, Effect> !UnwindSafe for StoreRef<State, Action, Event, Effect>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, V> IntoOptPropValue<V> for Twhere
T: IntoPropValue<Option<V>>,
impl<T, V> IntoOptPropValue<V> for Twhere
T: IntoPropValue<Option<V>>,
Source§fn into_opt_prop_value(self) -> Option<V>
fn into_opt_prop_value(self) -> Option<V>
self
to an optional value of a Properties
struct.Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self
to a value of a Properties
struct.