SubStore

Trait SubStore 

Source
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§

Source

fn state(&self) -> &SubState

Source

fn service(&mut self) -> &mut Self::Service

Source

fn state_and_service(&mut self) -> (&SubState, &mut Self::Service)

Source

fn dispatch<A>(&mut self, action: A) -> bool
where A: Into<Self::SubAction> + EnablingCondition<SubState>,

Source

fn dispatch_callback<T>(&mut self, callback: Callback<T>, args: T) -> bool
where T: 'static, Self::SubAction: From<AnyAction> + EnablingCondition<SubState>,

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.

Implementors§