redux/
sub_store.rs

1/// Useful when state machine is split into multiple crates. Using this
2/// trait we can pass `Store<GlobalState, Service, GlobalAction>`
3/// almost as if it were `Store<SubState, Service, SubAction>`.
4pub trait SubStore<GlobalState, SubState> {
5    type SubAction;
6    type Service;
7
8    fn state(&self) -> &SubState;
9    fn service(&mut self) -> &mut Self::Service;
10    fn state_and_service(&mut self) -> (&SubState, &mut Self::Service);
11    fn dispatch<A>(&mut self, action: A) -> bool
12    where
13        A: Into<Self::SubAction> + crate::EnablingCondition<SubState>;
14
15    fn dispatch_callback<T>(&mut self, callback: crate::Callback<T>, args: T) -> bool
16    where
17        T: 'static,
18        Self::SubAction: From<crate::AnyAction> + crate::EnablingCondition<SubState>;
19}