pub struct DispatchResult<E> {
pub changed: bool,
pub effects: Vec<E>,
}Expand description
Result of dispatching an action to an effect-aware store.
Contains both the state change indicator and any effects to be processed.
Fields§
§changed: boolWhether the state was modified by this action.
effects: Vec<E>Effects to be processed after dispatch.
Implementations§
Source§impl<E> DispatchResult<E>
impl<E> DispatchResult<E>
Sourcepub fn effects(effects: Vec<E>) -> Self
pub fn effects(effects: Vec<E>) -> Self
Create a result with multiple effects but no state change.
Sourcepub fn changed_with(effect: E) -> Self
pub fn changed_with(effect: E) -> Self
Create a result indicating state changed with a single effect.
Sourcepub fn changed_with_many(effects: Vec<E>) -> Self
pub fn changed_with_many(effects: Vec<E>) -> Self
Create a result indicating state changed with multiple effects.
Sourcepub fn mark_changed(self) -> Self
pub fn mark_changed(self) -> Self
Set the changed flag to true.
Sourcepub fn has_effects(&self) -> bool
pub fn has_effects(&self) -> bool
Returns true if there are any effects to process.
Trait Implementations§
Source§impl<E: Clone> Clone for DispatchResult<E>
impl<E: Clone> Clone for DispatchResult<E>
Source§fn clone(&self) -> DispatchResult<E>
fn clone(&self) -> DispatchResult<E>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<E: Debug> Debug for DispatchResult<E>
impl<E: Debug> Debug for DispatchResult<E>
Source§impl<E> Default for DispatchResult<E>
impl<E> Default for DispatchResult<E>
Source§impl<E: PartialEq> PartialEq for DispatchResult<E>
impl<E: PartialEq> PartialEq for DispatchResult<E>
impl<E: Eq> Eq for DispatchResult<E>
impl<E> StructuralPartialEq for DispatchResult<E>
Auto Trait Implementations§
impl<E> Freeze for DispatchResult<E>
impl<E> RefUnwindSafe for DispatchResult<E>where
E: RefUnwindSafe,
impl<E> Send for DispatchResult<E>where
E: Send,
impl<E> Sync for DispatchResult<E>where
E: Sync,
impl<E> Unpin for DispatchResult<E>where
E: Unpin,
impl<E> UnwindSafe for DispatchResult<E>where
E: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more