_promiseCompleted(futureIdentifier:)
AsyncTestingEventLoop.swift:391- iOS
- 13.0+
- macOS
- 10.15+
- tvOS
- 13.0+
- watchOS
- 6.0+
func _promiseCompleted(futureIdentifier: _NIOEventLoopFutureIdentifier) -> (file: StaticString, line: UInt)?
func _promiseCompleted(futureIdentifier: _NIOEventLoopFutureIdentifier) -> (file: StaticString, line: UInt)?
s11NIOEmbedded24NIOAsyncTestingEventLoopC17_promiseCompleted16futureIdentifiers12StaticStringV4file_Su4linetSg7NIOCore09_NIOEvente6FutureI0V_tF
What are these?4LOVO
import NIOEmbedded
final class NIOAsyncTestingEventLoop
An EventLoop
that is thread safe and whose execution is fully controlled by the user.
struct _NIOEventLoopFutureIdentifier
An opaque identifier for a specific EventLoopFuture
.
@frozen struct StaticString
A string type designed to represent text that is known at compile time.
@frozen struct UInt
An unsigned integer value type.
init()
Initialize a new NIOAsyncTestingEventLoop
.
var inEventLoop: Bool { get }
var now: NIODeadline { get }
The current “time” for this event loop. This is an amount in nanoseconds.
func _executeIsolatedUnsafeUnchecked(_ task: @escaping () -> Void)
func _preconditionSafeToSyncShutdown(file: StaticString, line: UInt)
func _preconditionSafeToWait(file: StaticString, line: UInt)
func _promiseCreated(futureIdentifier: _NIOEventLoopFutureIdentifier, file: StaticString, line: UInt)
@discardableResult func _scheduleTaskIsolatedUnsafeUnchecked<T>(deadline: NIODeadline, _ task: @escaping () throws -> T) -> Scheduled<T>
@discardableResult func _scheduleTaskIsolatedUnsafeUnchecked<T>(in delay: TimeAmount, _ task: @escaping () throws -> T) -> Scheduled<T>
func _submitIsolatedUnsafeUnchecked<T>(_ task: @escaping () throws -> T) -> EventLoopFuture<T>
func advanceTime(by increment: TimeAmount) async
Runs the event loop and moves “time” forward by the given amount, running any scheduled tasks that need to be run.
func advanceTime(to deadline: NIODeadline) async
Runs the event loop and moves “time” forward to the given point in time, running any scheduled tasks that need to be run.
@preconcurrency func execute(_ task: @escaping () -> Void)
On an NIOAsyncTestingEventLoop
, execute
will simply use scheduleTask
with a deadline of now. Unlike with the other operations, this will immediately execute, to eliminate a common class of bugs.
func executeInContext<ReturnType>(_ task: @escaping () throws -> ReturnType) async throws -> ReturnType where ReturnType : Sendable
Executes the given function in the context of this event loop. This is useful when it’s necessary to be confident that an operation is “blocking” the event loop. As long as you are executing, nothing else can execute in this loop.
func preconditionInEventLoop(file: StaticString, line: UInt)
func preconditionNotInEventLoop(file: StaticString, line: UInt)
func run() async
Run all tasks that have previously been submitted to this NIOAsyncTestingEventLoop
, either by calling execute
or events that have been enqueued using scheduleTask
/scheduleRepeatedTask
/scheduleRepeatedAsyncTask
and whose deadlines have expired.
@preconcurrency func scheduleCallback(at deadline: NIODeadline, handler: some (NIOScheduledCallbackHandler & Sendable)) throws -> NIOScheduledCallback
@discardableResult @preconcurrency func scheduleCallback(in amount: TimeAmount, handler: some (NIOScheduledCallbackHandler & Sendable)) throws -> NIOScheduledCallback
@discardableResult @preconcurrency func scheduleTask<T>(deadline: NIODeadline, _ task: @escaping () throws -> T) -> Scheduled<T>
@discardableResult @preconcurrency func scheduleTask<T>(in: TimeAmount, _ task: @escaping () throws -> T) -> Scheduled<T>
func shutdownGracefully() async
The concurrency-aware equivalent of shutdownGracefully(queue:_:)
.
@preconcurrency func shutdownGracefully(queue: DispatchQueue, _ callback: @escaping (Error?) -> Void)