Skip to content

Instance Method

performWithTask(_:)

Run the async function body on this event loop and return its result as an EventLoopFuture.
func performWithTask<Value>(_ body: @escaping @Sendable () async throws -> Value) -> EventLoopFuture<Value>

Parameters

body

The async function 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 EventLoop.

This method is deprecated. Call EventLoop.makeFutureWithTask(_:) directly instead.