Function effect

Source
pub fn effect(future: impl Future<Output = Result<()>> + Send + Sync + 'static)
Expand description

Schedules an effect to be applied. The passed future is executed once apply_effects is called.

The effect will only executed once. The passed future is executed outside of the current task and can’t read any Vcs. These need to be read before. ReadRefs can be passed into the future.

Effects are executed in parallel, so they might need to use async locking to avoid problems. Order of execution of multiple effects is not defined. You must not use mutliple conflicting effects to avoid non-deterministic behavior.