FutureType
public protocol FutureType
Generic Future Type
-
Type of the Element delivered with the below mentioned
eventupon .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
blockThe callback to invoke when the event has become available
-
Cancel the execution (when possible)
Declaration
Swift
func cancel(mayInterruptIfRunning flag: Bool) -> BoolParameters
flagwhether to send an interrupt to the executing thread when already executing
Return Value
falsewhen the task could not be cancelled,truewhen cancelled successfully -
Whether the execution is done (E.g. fulfilled, failed or cancelled)
Declaration
Swift
var done: Bool { get }