Skip to content

Instance Method

future(result:)

Creates a new Future from the worker’s event loop, succeeded or failed based on the input Result.
func future<T>(result: Result<T, any Error>) -> EventLoopFuture<T>

Parameters

result

The result that the future will wrap.

Return Value

The succeeded or failed future.

Discussion

let a: EventLoopFuture<String> = req.future(.success("hello"))
let b: EventLoopFuture<String> = req.future(.failed(Abort(.imATeapot))

See Also

EventLoop and EventLoopGroup