Contents

withSerialExecutor(_:)

Perform an operation with the actor’s Serialexecutor.

Declaration

nonisolated func withSerialExecutor<T, E>(_ operation: (any SerialExecutor) throws(E) -> T) throws(E) -> T where E : Error, T : ~Copyable

Discussion

This converts the actor’s unownedExecutor to a SerialExecutor while retaining the actor for the duration of the operation. This is to ensure the lifetime of the executor while performing the operation.