pub struct StoreWithMiddleware<Inner, M, State, InnerAction, OuterAction>where
Inner: StoreApi<State, InnerAction> + Send + Sync,
M: MiddleWare<State, OuterAction, Inner, InnerAction> + Send + Sync,
State: Send + Sync + 'static,
InnerAction: Send + Sync + 'static,
OuterAction: Send + Sync + 'static,{ /* private fields */ }
Expand description
Store which ties an underlying store and middleware together.
Implementations§
Source§impl<Inner, M, State, InnerAction, OuterAction> StoreWithMiddleware<Inner, M, State, InnerAction, OuterAction>
impl<Inner, M, State, InnerAction, OuterAction> StoreWithMiddleware<Inner, M, State, InnerAction, OuterAction>
Sourcepub async fn wrap<MNew, NewOuterAction>(
self,
middleware: MNew,
) -> StoreWithMiddleware<Self, MNew, State, OuterAction, NewOuterAction>
pub async fn wrap<MNew, NewOuterAction>( self, middleware: MNew, ) -> StoreWithMiddleware<Self, MNew, State, OuterAction, NewOuterAction>
Wrap the store with middleware
Trait Implementations§
Source§impl<Inner, M, State, InnerAction, OuterAction> StoreApi<State, OuterAction> for StoreWithMiddleware<Inner, M, State, InnerAction, OuterAction>
impl<Inner, M, State, InnerAction, OuterAction> StoreApi<State, OuterAction> for StoreWithMiddleware<Inner, M, State, InnerAction, OuterAction>
Source§fn dispatch<'life0, 'async_trait>(
&'life0 self,
action: OuterAction,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn dispatch<'life0, 'async_trait>(
&'life0 self,
action: OuterAction,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dispatch a new action to the store Read more
Source§fn select<'life0, 'async_trait, S, Result>(
&'life0 self,
selector: S,
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>
fn select<'life0, 'async_trait, S, Result>( &'life0 self, selector: S, ) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>
Select a part of the state, this is more efficient than copying the entire state all the time.
In case you still need a full copy of the state, use the state_cloned method.
Source§fn subscribe<'life0, 'async_trait, S>(
&'life0 self,
subscriber: S,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
S: 'async_trait + Subscriber<State> + Send + 'static,
Self: 'async_trait,
'life0: 'async_trait,
fn subscribe<'life0, 'async_trait, S>(
&'life0 self,
subscriber: S,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
S: 'async_trait + Subscriber<State> + Send + 'static,
Self: 'async_trait,
'life0: 'async_trait,
Subscribe to state changes.
Every time an action is dispatched the subscriber will be notified after the state is updated
Auto Trait Implementations§
impl<Inner, M, State, InnerAction, OuterAction> Freeze for StoreWithMiddleware<Inner, M, State, InnerAction, OuterAction>where
M: Freeze,
impl<Inner, M, State, InnerAction, OuterAction> RefUnwindSafe for StoreWithMiddleware<Inner, M, State, InnerAction, OuterAction>where
M: RefUnwindSafe,
State: RefUnwindSafe,
InnerAction: RefUnwindSafe,
OuterAction: RefUnwindSafe,
Inner: RefUnwindSafe,
impl<Inner, M, State, InnerAction, OuterAction> Send for StoreWithMiddleware<Inner, M, State, InnerAction, OuterAction>
impl<Inner, M, State, InnerAction, OuterAction> Sync for StoreWithMiddleware<Inner, M, State, InnerAction, OuterAction>
impl<Inner, M, State, InnerAction, OuterAction> Unpin for StoreWithMiddleware<Inner, M, State, InnerAction, OuterAction>
impl<Inner, M, State, InnerAction, OuterAction> UnwindSafe for StoreWithMiddleware<Inner, M, State, InnerAction, OuterAction>where
M: UnwindSafe,
Inner: RefUnwindSafe,
State: UnwindSafe,
InnerAction: UnwindSafe,
OuterAction: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more