Struct StoreWithMiddleware

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

Source

pub async fn wrap<MNew, NewOuterAction>( self, middleware: MNew, ) -> StoreWithMiddleware<Self, MNew, State, OuterAction, NewOuterAction>
where MNew: MiddleWare<State, NewOuterAction, Self, OuterAction> + Send + Sync, NewOuterAction: Send + Sync + 'static, State: Sync,

Wrap the store with middleware

Trait Implementations§

Source§

impl<Inner, M, State, InnerAction, OuterAction> StoreApi<State, OuterAction> for 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,

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,

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>>
where S: Selector<State, Result = Result> + Send + 'static + 'async_trait, Result: Send + 'static + 'async_trait, Self: 'async_trait, 'life0: '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,

Subscribe to state changes. Every time an action is dispatched the subscriber will be notified after the state is updated
Source§

fn state_cloned<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = State> + Send + 'async_trait>>
where State: Clone, Self: Sync + 'async_trait, 'life0: 'async_trait,

Returns a cloned version of the state. This is not efficient, if you only need a part of the state use select instead

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>
where M: Unpin, State: Unpin, InnerAction: Unpin, OuterAction: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.