NIOAsyncTestingEventLoop (ext)
You’re viewing third-party extensions to NIOAsyncTestingEventLoop
, a class from swift-nio.
You can also read the documentation forNIOAsyncTestingEventLoop
itself.
extension NIOAsyncTestingEventLoop
You’re viewing third-party extensions to NIOAsyncTestingEventLoop
, a class from swift-nio.
You can also read the documentation forNIOAsyncTestingEventLoop
itself.
extension NIOAsyncTestingEventLoop
final class NIOAsyncTestingEventLoop
An EventLoop
that is thread safe and whose execution is fully controlled by the user.
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
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>(_ value: T) -> EventLoopFuture<T>
Creates a new, succeeded EventLoopFuture
from the worker’s event loop.
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 makeFutureWithTask<Value>(_ body: @escaping () async throws -> Value) -> EventLoopFuture<Value>
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 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
.
func performWithTask<Value>(_ body: @escaping () async throws -> Value) -> EventLoopFuture<Value>
Run the async
function body
on this event loop and return its result as an EventLoopFuture
.