future(result:)

Creates a new Future from the worker’s event loop, succeeded or failed based on the input Result.

EventLoop+Future.swift:40
func future<T>(result: Result<T, Error>) -> EventLoopFuture<T>

Parameters

result

The result that the future will wrap.

Returns

The succeeded or failed future.

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