CancellablePromise
public class CancellablePromise<T> : CancellableThenable, CancellableCatchMixin
extension CancellablePromise: _PMKSharedWrappers
extension CancellablePromise: _PMKCatchWrappers
extension CancellablePromise: _PMKSharedVoidWrappers where C.T == Void
A CancellablePromise
is a functional abstraction around a failable and cancellable asynchronous operation.
At runtime the promise can become a member of a chain of promises, where the cancelContext
is used to track and cancel (if desired) all promises in this chain.
-
Delegate
thenable
for this CancellablePromiseDeclaration
Swift
public var thenable: U { get }
-
Delegate
catchable
for this CancellablePromiseDeclaration
Swift
public var catchable: C { get }
-
The CancelContext associated with this CancellablePromise
Declaration
Swift
public var cancelContext: CancelContext
-
Tracks the cancel items for this CancellablePromise. These items are removed from the associated CancelContext when the promise resolves.
Declaration
Swift
public var cancelItemList: CancelItemList
-
Initialize a new rejected cancellable promise.
Declaration
Swift
public convenience init(cancellable: Cancellable? = nil, error: Error)
-
Initialize a new cancellable promise that can be resolved with the provided
Resolver
.Declaration
Swift
public convenience init(cancellable: Cancellable? = nil, resolver body: (Resolver<T>) throws -> Void)
-
Initialize a new cancellable promise using the given Promise and its Resolver.
Declaration
Swift
public convenience init(cancellable: Cancellable? = nil, promise: Promise<T>, resolver: Resolver<T>)
-
See
Thenable.result
Declaration
Swift
public var result: Result<T, Error>? { get }
Return Value
The current
Result
for this cancellable promise. -
Blocks this thread, so—you know—don’t call this on a serial thread that any part of your chain may use. Like the main thread for example.
Declaration
Swift
public func wait() throws -> T
-
Undocumented
Declaration
Swift
public typealias T = T
-
Undocumented
Declaration
Swift
public typealias BaseOfT = CancellablePromise<T>
-
Initializes a new cancellable promise fulfilled with
Void
Declaration
Swift
public convenience init()
-
Initializes a new cancellable promise fulfilled with
Void
and with the givenCancellable
Declaration
Swift
public convenience init(cancellable: Cancellable)