pub trait SubStore<GlobalState, SubState> {
type SubAction;
type Service;
// Required methods
fn state(&self) -> &SubState;
fn service(&mut self) -> &mut Self::Service;
fn state_and_service(&mut self) -> (&SubState, &mut Self::Service);
fn dispatch<A>(&mut self, action: A) -> bool
where A: Into<Self::SubAction> + EnablingCondition<SubState>;
fn dispatch_callback<T>(&mut self, callback: Callback<T>, args: T) -> bool
where T: 'static,
Self::SubAction: From<AnyAction> + EnablingCondition<SubState>;
}Expand description
Useful when state machine is split into multiple crates. Using this
trait we can pass Store<GlobalState, Service, GlobalAction>
almost as if it were Store<SubState, Service, SubAction>.
Required Associated Types§
Required Methods§
fn state(&self) -> &SubState
fn service(&mut self) -> &mut Self::Service
fn state_and_service(&mut self) -> (&SubState, &mut Self::Service)
fn dispatch<A>(&mut self, action: A) -> bool
fn dispatch_callback<T>(&mut self, callback: Callback<T>, args: T) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.