1use crate::{Effect, Store};
2
3pub trait Reducer<State, Action: Send> {
6 fn reduce(state: &mut State, action: Action) -> Effect<Action>;
7
8 fn store(initial_state: State) -> Store<State, Action>
11 where
12 Self: Send + Sync + Sized + 'static,
13 Action: std::fmt::Debug + Send + 'static,
14 State: PartialEq + Clone + Send + Sync + 'static,
15 {
16 Store::new::<Self>(initial_state)
17 }
18
19 fn default_store() -> Store<State, Action>
22 where
23 Self: Send + Sync + Sized + 'static,
24 Action: std::fmt::Debug + Send + 'static,
25 State: Default + PartialEq + Clone + Send + Sync + 'static,
26 {
27 Store::new::<Self>(State::default())
28 }
29}