Instance Method
future(_:)
Creates a new, succeeded
EventLoopFuture from the worker’s event loop.func future<T>(_ value: T) -> EventLoopFuture<T>
Parameters
valueThe value that the future will wrap.
Return Value
The succeeded future.
Discussion
Let a: EventLoopFuture = req.future(“hello”)
See Also
EventLoop and EventLoopGroup
func flatten<T>([EventLoopFuture<T>]) -> EventLoopFuture<[T]>Returns a newEventLoopFuturethat succeeds only when all the provided futures succeed. The newEventLoopFuturecontains an array of results, maintaining same ordering as the futures.func flatten([EventLoopFuture<Void>]) -> EventLoopFuture<Void>Returns a newEventLoopFuturethat succeeds only when all the provided futures succeed, ignoring the resolved values.func future() -> EventLoopFuture<Void>Creates a new, succeededEventLoopFuturefrom the worker’s event loop with aVoidvalue.func future<T>(error: any Error) -> EventLoopFuture<T>Creates a new, failedEventLoopFuturefrom the worker’s event loop.func future<T>(result: Result<T, any Error>) -> EventLoopFuture<T>Creates a newFuturefrom the worker’s event loop, succeeded or failed based on the inputResult.func tryFuture<T>(() throws -> T) -> EventLoopFuture<T>An alternate name for this would befuture(catching:), but with that name, trailing closure syntax just looks likeel.future { ... }, which does not indicate to readers of the code that it is the error-capturing version. Since such an indication is highly desirable, a slightly less idiomatic name is used instead.