Contents

resume(with:)

Resume the task awaiting the continuation by having it either return normally or throw an error based on the state of the given Result value.

Declaration

func resume<Er>(with result: sending Result<T, Er>) where E == any Error, Er : Error

Parameters

  • result:

    A value to either return or throw from the continuation.

Discussion

A continuation must be resumed exactly once. If the continuation has already been resumed through this object, then the attempt to resume the continuation will trap.

After resume enqueues the task, control immediately returns to the caller. The task continues executing when its executor is able to reschedule it.