Trait composable::effects::Effects
source · pub trait Effects: Clone + Scheduler<Action = Self::Action> {
type Action;
// Required methods
fn action(&self, action: impl Into<<Self as Effects>::Action>);
fn task<S: Stream<Item = <Self as Effects>::Action> + 'static>(
&self,
stream: S,
) -> Task;
// Provided methods
fn future<F: Future<Output = Option<<Self as Effects>::Action>> + 'static>(
&self,
future: F,
)
where <Self as Effects>::Action: 'static { ... }
fn stream<S: Stream<Item = <Self as Effects>::Action> + 'static>(
&self,
stream: S,
) { ... }
fn scope<ChildAction>(&self) -> Scoped<Self, ChildAction>
where <Self as Effects>::Action: From<ChildAction> { ... }
}
Expand description
Effects
are used within Reducer
s to propagate Action
s as side-effects of performing other Action
s.
Effects
are also Scheduler
s — able to apply modifiers to when (and how often) Action
s. are sent.
See the module level documentation for more.
Required Associated Types§
Required Methods§
Provided Methods§
sourcefn future<F: Future<Output = Option<<Self as Effects>::Action>> + 'static>(
&self,
future: F,
)
fn future<F: Future<Output = Option<<Self as Effects>::Action>> + 'static>( &self, future: F, )
sourcefn scope<ChildAction>(&self) -> Scoped<Self, ChildAction>
fn scope<ChildAction>(&self) -> Scoped<Self, ChildAction>
Scopes the Effects
down to one that sends child actions.
For example, the inner loop of the RecursiveReducer
macro is,
effectively, just calling
ⓘ
if let Ok(action) = action.clone().try_into() {
reduce(&mut self.child_reducer, action, effects.scope());
}
on each child-reducer.
Object Safety§
This trait is not object safe.