Skip to main content

effect

macro_rules! effect {
    ($run_time:ident, $body:block) => { ... };
}
Expand description

Wraps an async body into the full MappedEffect closure boilerplate. $run_time names the Arc<ApplicationRunTime> parameter inside the body.

Before:

let effect = move |run_time: Arc<ApplicationRunTime>|
    -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send>> {
    Box::pin(async move { ... })
};
Some(Ok(Box::new(effect)))

After: effect!(run_time, { ... })