Promise
public final class Promise<Output> : FutureProtocol
An one-shot slot that can be used to communicate a value between tasks.
Promise
is safe to use between any number of tasks that are racing to
provide the value and a single task that is polling for it.
Promise
is only able to communicate a single value. If you need to
efficiently communicate a sequence of asynchronously produced values, see
Channel.Unbuffered
.
-
Declaration
Swift
@inlinable public init()
-
-
Declaration
Swift
@inlinable public func resolve<F>(when future: F) -> Resolve<F> where Output == F.Output, F : FutureProtocol
-
Declaration
Swift
@inlinable public func resolve(_ value: Output)
-
Declaration
Swift
@inlinable public func resolve()
-
Declaration
Swift
@inlinable public func fulfill(_ value: Output.Success)
-
Declaration
Swift
@inlinable public func reject(_ error: Output.Failure)