pub async fn get_effects(source: impl CollectiblesSource) -> Result<Effects>
Expand description
Capture effects from an turbo-tasks operation. Since this captures collectibles it might invalidate the current task when effects are changing or even temporary change.
Therefore it’s important to wrap this in a strongly consistent read before applying the effects
with Effects::apply
.
§Example
async fn some_turbo_tasks_function_with_effects(args: Args) -> Result<ResultWithEffects> {
let operation = some_turbo_tasks_function(args);
let result = operation.strongly_consistent().await?;
let effects = get_effects(operation).await?;
Ok(ResultWithEffects { result, effects })
}
let result_with_effects = some_turbo_tasks_function_with_effects(args).strongly_consistent().await?;
result_with_effects.effects.apply().await?;