Async Handlers
Adds support for async
closures, making it easy to store the continuations within an actor:
let val: String? = await withIdentifiableContinuation {
await someActor.insertContinuation($0)
} onCancel: {
await someActor.cancelContinuation(for: $0)
}
The onCancel:
handler is still guaranteed to be called after the continuation body executes to completion, even if the task is already cancelled.