pub struct ReducerResult<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> ReducerResult<E>
impl<E> ReducerResult<E>
Sourcepub fn unchanged() -> ReducerResult<E>
pub fn unchanged() -> ReducerResult<E>
Create a result indicating no state change and no effects.
Sourcepub fn changed() -> ReducerResult<E>
pub fn changed() -> ReducerResult<E>
Create a result indicating state changed but no effects.
Sourcepub fn effect(effect: E) -> ReducerResult<E>
pub fn effect(effect: E) -> ReducerResult<E>
Create a result with a single effect but no state change.
Sourcepub fn effects(effects: Vec<E>) -> ReducerResult<E>
pub fn effects(effects: Vec<E>) -> ReducerResult<E>
Create a result with multiple effects but no state change.
Sourcepub fn changed_with(effect: E) -> ReducerResult<E>
pub fn changed_with(effect: E) -> ReducerResult<E>
Create a result indicating state changed with a single effect.
Sourcepub fn changed_with_many(effects: Vec<E>) -> ReducerResult<E>
pub fn changed_with_many(effects: Vec<E>) -> ReducerResult<E>
Create a result indicating state changed with multiple effects.
Sourcepub fn with(self, effect: E) -> ReducerResult<E>
pub fn with(self, effect: E) -> ReducerResult<E>
Add an effect to this result.
Sourcepub fn mark_changed(self) -> ReducerResult<E>
pub fn mark_changed(self) -> ReducerResult<E>
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 for ReducerResult<E>where
E: Clone,
impl<E> Clone for ReducerResult<E>where
E: Clone,
Source§fn clone(&self) -> ReducerResult<E>
fn clone(&self) -> ReducerResult<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 for ReducerResult<E>where
E: Debug,
impl<E> Debug for ReducerResult<E>where
E: Debug,
Source§impl<E> Default for ReducerResult<E>
impl<E> Default for ReducerResult<E>
Source§fn default() -> ReducerResult<E>
fn default() -> ReducerResult<E>
Returns the “default value” for a type. Read more
Source§impl<E> PartialEq for ReducerResult<E>where
E: PartialEq,
impl<E> PartialEq for ReducerResult<E>where
E: PartialEq,
impl<E> Eq for ReducerResult<E>where
E: Eq,
impl<E> StructuralPartialEq for ReducerResult<E>
Auto Trait Implementations§
impl<E> Freeze for ReducerResult<E>
impl<E> RefUnwindSafe for ReducerResult<E>where
E: RefUnwindSafe,
impl<E> Send for ReducerResult<E>where
E: Send,
impl<E> Sync for ReducerResult<E>where
E: Sync,
impl<E> Unpin for ReducerResult<E>where
E: Unpin,
impl<E> UnwindSafe for ReducerResult<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