Instance Method
performWithTask(_:)
Run the
async function body on an event loop in this group and return its result as an EventLoopFuture.func performWithTask<Value>(_ body: @escaping @Sendable () async throws -> Value) -> EventLoopFuture<Value>
Parameters
bodyThe
asyncfunction to run.
Return Value
An EventLoopFuture which is completed when body finishes. On success the future has the result returned by body; if body throws an error, the future is failed with that error.
Discussion
This function can be used to bridge the async world into an EventLoopGroup.
See also EventLoop.performWithTask(_:), EventLoopPromise.completeWithTask(_:)