FutureType
public protocol FutureType
Generic Future Type
-
Type of the Element delivered with the below mentioned
event
upon .completedDeclaration
Swift
associatedtype Element
-
Register a callback/continuation block for when the Future fulfills.
Note
this prevents blocking execution of calling thread, the callback is invoked from the producing thread/queueDeclaration
Swift
func on(event block: @escaping Consumer<FutureEvent<Element>>)
Parameters
block
The callback to invoke when the event has become available
-
Cancel the execution (when possible)
Declaration
Swift
func cancel(mayInterruptIfRunning flag: Bool) -> Bool
Parameters
flag
whether to send an interrupt to the executing thread when already executing
Return Value
false
when the task could not be cancelled,true
when cancelled successfully -
Whether the execution is done (E.g. fulfilled, failed or cancelled)
Declaration
Swift
var done: Bool { get }