[−][src]Trait reducer::Reactor
Trait for types that react to state transitions.
Reactors connect the state to the view components. They can implement arbitrary logic in response to state transitions, but it's often better to think of Reactors as channels that transmit the current state to other parts of your application.
Associated Types
type Error
The type returned if the Reactor fails.
Required methods
fn react(&mut self, state: &S) -> Result<(), Self::Error>
Reacts to an update to S
.
Example
use reducer::*; use std::fmt::Debug; use std::io::{self, Write}; struct Console; impl<T: Debug> Reactor<T> for Console { type Error = io::Error; fn react(&mut self, state: &T) -> io::Result<()> { io::stdout().write_fmt(format_args!("{:?}\n", state)) } }
Methods
impl<S, E> dyn Reactor<S, Error = E> where
S: Clone,
[src]
S: Clone,
pub fn from_sink<T>(
sink: T
) -> impl Reactor<S, Error = E> + Sink<S, SinkError = E> + DerefMut<Target = T> where
T: Sink<S, SinkError = E> + Unpin,
[src]
sink: T
) -> impl Reactor<S, Error = E> + Sink<S, SinkError = E> + DerefMut<Target = T> where
T: Sink<S, SinkError = E> + Unpin,
Adapts any type that implements Sink
as a Reactor
(requires async
).
Example
use reducer::*; use futures::channel::mpsc::channel; use futures::executor::block_on_stream; use std::thread; let (tx, rx) = channel(0); let mut reactor = Reactor::<Error = _>::from_sink(tx); thread::spawn(move || { reactor.react(&1); reactor.react(&1); reactor.react(&3); reactor.react(&5); reactor.react(&8); }); assert_eq!(block_on_stream(rx).collect::<Vec<_>>(), vec![1, 1, 3, 5, 8]);
Implementations on Foreign Types
impl<S, T> Reactor<S> for [T; 0] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 1] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 2] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 3] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 4] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 5] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 6] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 7] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 8] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 9] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 10] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 11] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 12] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 13] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 14] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 15] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 16] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 17] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 18] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 19] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 20] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 21] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 22] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 23] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 24] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 25] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 26] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 27] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 28] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 29] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 30] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 31] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T> Reactor<S> for [T; 32] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the array in order.
Currently implemented for arrays of up to 32 elements.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let a = Actor { /* ... */ }; let b = Actor { /* ... */ }; // ... let z = Actor { /* ... */ }; let mut store = Store::new(State { /* ... */ }, [a, b, /* ..., */ z]); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, T: ?Sized> Reactor<S> for Box<T> where
T: Reactor<S>,
[src]
T: Reactor<S>,
impl<'a, S, T: ?Sized> Reactor<S> for &'a mut T where
T: Reactor<S>,
[src]
T: Reactor<S>,
Forwards the event to a potentially stack allocated Reactor
.
impl<S, T> Reactor<S> for [T] where
T: Reactor<S>,
[src]
T: Reactor<S>,
Notifies all Reactor
s in the slice in order.
Example
use reducer::*; struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct Actor { /* ... */ } struct ActorError(/*...*/); impl Reactor<State> for Actor { type Error = ActorError; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } let mut actors = vec![]; actors.push(Actor { /* ... */ }); actors.push(Actor { /* ... */ }); // ... actors.push(Actor { /* ... */ }); let mut store = Store::new(State { /* ... */ }, actors.into_boxed_slice()); // All actors get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, X, A> Reactor<S> for (A,) where
A: Reactor<S, Error = X>,
[src]
A: Reactor<S, Error = X>,
Notifies all Reactor
s in the tuple in order.
Currently implemented for tuples of up to 12 elements.
Example
use reducer::*; use std::error::Error; #[derive(Debug)] struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct GUI { /* ... */ } struct DebugLogger { /* ... */ } impl Reactor<State> for GUI { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } impl Reactor<State> for DebugLogger { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { println!("[DEBUG] {:#?}", state); Ok(()) } } let gui = GUI { /* ... */ }; let logger = DebugLogger { /* ... */ }; let mut store = Store::new(State { /* ... */ }, (gui, logger)); // Both `gui` and `logger` get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, X, A, B> Reactor<S> for (A, B) where
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
[src]
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
Notifies all Reactor
s in the tuple in order.
Currently implemented for tuples of up to 12 elements.
Example
use reducer::*; use std::error::Error; #[derive(Debug)] struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct GUI { /* ... */ } struct DebugLogger { /* ... */ } impl Reactor<State> for GUI { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } impl Reactor<State> for DebugLogger { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { println!("[DEBUG] {:#?}", state); Ok(()) } } let gui = GUI { /* ... */ }; let logger = DebugLogger { /* ... */ }; let mut store = Store::new(State { /* ... */ }, (gui, logger)); // Both `gui` and `logger` get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, X, A, B, C> Reactor<S> for (A, B, C) where
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
[src]
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
Notifies all Reactor
s in the tuple in order.
Currently implemented for tuples of up to 12 elements.
Example
use reducer::*; use std::error::Error; #[derive(Debug)] struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct GUI { /* ... */ } struct DebugLogger { /* ... */ } impl Reactor<State> for GUI { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } impl Reactor<State> for DebugLogger { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { println!("[DEBUG] {:#?}", state); Ok(()) } } let gui = GUI { /* ... */ }; let logger = DebugLogger { /* ... */ }; let mut store = Store::new(State { /* ... */ }, (gui, logger)); // Both `gui` and `logger` get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, X, A, B, C, D> Reactor<S> for (A, B, C, D) where
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
[src]
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
Notifies all Reactor
s in the tuple in order.
Currently implemented for tuples of up to 12 elements.
Example
use reducer::*; use std::error::Error; #[derive(Debug)] struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct GUI { /* ... */ } struct DebugLogger { /* ... */ } impl Reactor<State> for GUI { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } impl Reactor<State> for DebugLogger { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { println!("[DEBUG] {:#?}", state); Ok(()) } } let gui = GUI { /* ... */ }; let logger = DebugLogger { /* ... */ }; let mut store = Store::new(State { /* ... */ }, (gui, logger)); // Both `gui` and `logger` get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, X, A, B, C, D, E> Reactor<S> for (A, B, C, D, E) where
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
[src]
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
Notifies all Reactor
s in the tuple in order.
Currently implemented for tuples of up to 12 elements.
Example
use reducer::*; use std::error::Error; #[derive(Debug)] struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct GUI { /* ... */ } struct DebugLogger { /* ... */ } impl Reactor<State> for GUI { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } impl Reactor<State> for DebugLogger { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { println!("[DEBUG] {:#?}", state); Ok(()) } } let gui = GUI { /* ... */ }; let logger = DebugLogger { /* ... */ }; let mut store = Store::new(State { /* ... */ }, (gui, logger)); // Both `gui` and `logger` get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, X, A, B, C, D, E, F> Reactor<S> for (A, B, C, D, E, F) where
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
[src]
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
Notifies all Reactor
s in the tuple in order.
Currently implemented for tuples of up to 12 elements.
Example
use reducer::*; use std::error::Error; #[derive(Debug)] struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct GUI { /* ... */ } struct DebugLogger { /* ... */ } impl Reactor<State> for GUI { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } impl Reactor<State> for DebugLogger { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { println!("[DEBUG] {:#?}", state); Ok(()) } } let gui = GUI { /* ... */ }; let logger = DebugLogger { /* ... */ }; let mut store = Store::new(State { /* ... */ }, (gui, logger)); // Both `gui` and `logger` get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, X, A, B, C, D, E, F, G> Reactor<S> for (A, B, C, D, E, F, G) where
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
G: Reactor<S, Error = X>,
[src]
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
G: Reactor<S, Error = X>,
Notifies all Reactor
s in the tuple in order.
Currently implemented for tuples of up to 12 elements.
Example
use reducer::*; use std::error::Error; #[derive(Debug)] struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct GUI { /* ... */ } struct DebugLogger { /* ... */ } impl Reactor<State> for GUI { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } impl Reactor<State> for DebugLogger { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { println!("[DEBUG] {:#?}", state); Ok(()) } } let gui = GUI { /* ... */ }; let logger = DebugLogger { /* ... */ }; let mut store = Store::new(State { /* ... */ }, (gui, logger)); // Both `gui` and `logger` get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, X, A, B, C, D, E, F, G, H> Reactor<S> for (A, B, C, D, E, F, G, H) where
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
G: Reactor<S, Error = X>,
H: Reactor<S, Error = X>,
[src]
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
G: Reactor<S, Error = X>,
H: Reactor<S, Error = X>,
Notifies all Reactor
s in the tuple in order.
Currently implemented for tuples of up to 12 elements.
Example
use reducer::*; use std::error::Error; #[derive(Debug)] struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct GUI { /* ... */ } struct DebugLogger { /* ... */ } impl Reactor<State> for GUI { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } impl Reactor<State> for DebugLogger { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { println!("[DEBUG] {:#?}", state); Ok(()) } } let gui = GUI { /* ... */ }; let logger = DebugLogger { /* ... */ }; let mut store = Store::new(State { /* ... */ }, (gui, logger)); // Both `gui` and `logger` get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, X, A, B, C, D, E, F, G, H, I> Reactor<S> for (A, B, C, D, E, F, G, H, I) where
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
G: Reactor<S, Error = X>,
H: Reactor<S, Error = X>,
I: Reactor<S, Error = X>,
[src]
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
G: Reactor<S, Error = X>,
H: Reactor<S, Error = X>,
I: Reactor<S, Error = X>,
Notifies all Reactor
s in the tuple in order.
Currently implemented for tuples of up to 12 elements.
Example
use reducer::*; use std::error::Error; #[derive(Debug)] struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct GUI { /* ... */ } struct DebugLogger { /* ... */ } impl Reactor<State> for GUI { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } impl Reactor<State> for DebugLogger { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { println!("[DEBUG] {:#?}", state); Ok(()) } } let gui = GUI { /* ... */ }; let logger = DebugLogger { /* ... */ }; let mut store = Store::new(State { /* ... */ }, (gui, logger)); // Both `gui` and `logger` get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, X, A, B, C, D, E, F, G, H, I, J> Reactor<S> for (A, B, C, D, E, F, G, H, I, J) where
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
G: Reactor<S, Error = X>,
H: Reactor<S, Error = X>,
I: Reactor<S, Error = X>,
J: Reactor<S, Error = X>,
[src]
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
G: Reactor<S, Error = X>,
H: Reactor<S, Error = X>,
I: Reactor<S, Error = X>,
J: Reactor<S, Error = X>,
Notifies all Reactor
s in the tuple in order.
Currently implemented for tuples of up to 12 elements.
Example
use reducer::*; use std::error::Error; #[derive(Debug)] struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct GUI { /* ... */ } struct DebugLogger { /* ... */ } impl Reactor<State> for GUI { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } impl Reactor<State> for DebugLogger { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { println!("[DEBUG] {:#?}", state); Ok(()) } } let gui = GUI { /* ... */ }; let logger = DebugLogger { /* ... */ }; let mut store = Store::new(State { /* ... */ }, (gui, logger)); // Both `gui` and `logger` get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, X, A, B, C, D, E, F, G, H, I, J, K> Reactor<S> for (A, B, C, D, E, F, G, H, I, J, K) where
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
G: Reactor<S, Error = X>,
H: Reactor<S, Error = X>,
I: Reactor<S, Error = X>,
J: Reactor<S, Error = X>,
K: Reactor<S, Error = X>,
[src]
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
G: Reactor<S, Error = X>,
H: Reactor<S, Error = X>,
I: Reactor<S, Error = X>,
J: Reactor<S, Error = X>,
K: Reactor<S, Error = X>,
Notifies all Reactor
s in the tuple in order.
Currently implemented for tuples of up to 12 elements.
Example
use reducer::*; use std::error::Error; #[derive(Debug)] struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct GUI { /* ... */ } struct DebugLogger { /* ... */ } impl Reactor<State> for GUI { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } impl Reactor<State> for DebugLogger { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { println!("[DEBUG] {:#?}", state); Ok(()) } } let gui = GUI { /* ... */ }; let logger = DebugLogger { /* ... */ }; let mut store = Store::new(State { /* ... */ }, (gui, logger)); // Both `gui` and `logger` get notified of state changes. store.dispatch(Action { /* ... */ });
impl<S, X, A, B, C, D, E, F, G, H, I, J, K, L> Reactor<S> for (A, B, C, D, E, F, G, H, I, J, K, L) where
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
G: Reactor<S, Error = X>,
H: Reactor<S, Error = X>,
I: Reactor<S, Error = X>,
J: Reactor<S, Error = X>,
K: Reactor<S, Error = X>,
L: Reactor<S, Error = X>,
[src]
A: Reactor<S, Error = X>,
B: Reactor<S, Error = X>,
C: Reactor<S, Error = X>,
D: Reactor<S, Error = X>,
E: Reactor<S, Error = X>,
F: Reactor<S, Error = X>,
G: Reactor<S, Error = X>,
H: Reactor<S, Error = X>,
I: Reactor<S, Error = X>,
J: Reactor<S, Error = X>,
K: Reactor<S, Error = X>,
L: Reactor<S, Error = X>,
Notifies all Reactor
s in the tuple in order.
Currently implemented for tuples of up to 12 elements.
Example
use reducer::*; use std::error::Error; #[derive(Debug)] struct State { /* ... */ } struct Action { /* ... */ } impl Reducer<Action> for State { fn reduce(&mut self, action: Action) { // ... } } struct GUI { /* ... */ } struct DebugLogger { /* ... */ } impl Reactor<State> for GUI { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { // ... Ok(()) } } impl Reactor<State> for DebugLogger { type Error = Box<dyn Error>; fn react(&mut self, state: &State) -> Result<(), Self::Error> { println!("[DEBUG] {:#?}", state); Ok(()) } } let gui = GUI { /* ... */ }; let logger = DebugLogger { /* ... */ }; let mut store = Store::new(State { /* ... */ }, (gui, logger)); // Both `gui` and `logger` get notified of state changes. store.dispatch(Action { /* ... */ });