future(_:)
Creates a new, succeeded EventLoopFuture
from the worker’s event loop.
func future<T>(_ value: T) -> EventLoopFuture<T>
Parameters
- value
The value that the future will wrap.
Returns
The succeeded future.
let a: EventLoopFuture
Creates a new, succeeded EventLoopFuture
from the worker’s event loop.
func future<T>(_ value: T) -> EventLoopFuture<T>
s7NIOCore14EventLoopGroupP8AsyncKitE6futureyAA0bC6FutureCyqd__Gqd__lF
What are these?76LN3
The value that the future will wrap.
The succeeded future.
let a: EventLoopFuture
import NIOCore
The core abstractions that make up SwiftNIO.
import AsyncKit
Provides a set of utilities for working with EventLoopFutures and other pre-Concurrency support APIs.
protocol EventLoopGroup : AnyObject, _NIOPreconcurrencySendable
Provides an endless stream of EventLoop
s to use.
final class EventLoopFuture<Value>
Holder for a result that will be provided later.
func flatten<T>(_ futures: [EventLoopFuture<T>]) -> EventLoopFuture<[T]>
Returns a new EventLoopFuture
that succeeds only when all the provided futures succeed. The new EventLoopFuture
contains an array of results, maintaining same ordering as the futures.
func flatten(_ futures: [EventLoopFuture<Void>]) -> EventLoopFuture<Void>
Returns a new EventLoopFuture
that succeeds only when all the provided futures succeed, ignoring the resolved values.
func future() -> EventLoopFuture<Void>
Creates a new, succeeded EventLoopFuture
from the worker’s event loop with a Void
value.
func future<T>(error: Error) -> EventLoopFuture<T>
Creates a new, failed EventLoopFuture
from the worker’s event loop.
func future<T>(result: Result<T, Error>) -> EventLoopFuture<T>
Creates a new Future
from the worker’s event loop, succeeded or failed based on the input Result
.
func tryFuture<T>(_ work: @escaping () throws -> T) -> EventLoopFuture<T>
An alternate name for this would be future(catching:)
, but with that name, trailing closure syntax just looks like el.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.
func makeFutureWithTask<Value>(_ body: @escaping () async throws -> Value) -> EventLoopFuture<Value>
func performWithTask<Value>(_ body: @escaping () async throws -> Value) -> EventLoopFuture<Value>
Run the async
function body
on an event loop in this group and return its result as an EventLoopFuture
.