Future(T)
A Future represents a value which may or may not currently be available, but will be available at some point, or an exception if that value could not be made available.
Constructors
Instance methods
Same as #await, but returns a Timeout exception if the given t expires.
Same as #await!, but raises a Timeout exception if the given t expires.
Awaits the completion of the future and either returns the computed value or raises an exception.
Returns true if the future has completed - either with a value or an exception.
Returns false otherwise.
Creates a new future by applying a function to the successful result of this future, and returns the result of the function as the new future.
If this future is completed with an exception then the new future will also contain this exception.
Creates a new future by applying a function to the successful result of this future.
If this future is completed with an exception then the new future will also contain this exception.
Creates a new Future which is completed with this Future's result if
that conforms to type typ or a TypeCastError otherwise.
Applies the side-effecting function to the result of this future, and returns a new future with the result of this future.
This method allows one to enforce that the callbacks are executed in a specified order.
Note: if one of the chained on_complete callbacks throws an exception, that exception is not
propagated to the subsequent on_complete callbacks. Instead, the subsequent on_complete callbacks
are given the original value of this future.
Applies the side-effecting function to the result of this future if it raised an error, and returns a new future with the result of this future.
WARNING: Will not be called if this future is never completed or if it is completed with success.
Applies the side-effecting function to the result of this future if it was successful, and returns a new future with the result of this future.
WARNING: Will not be called if this future is never completed or if it is completed with an error.
Creates a new future that will handle any matching throwable that this future might contain. If there is no match, or if this future contains a valid result then the new future will contain the same.
Creates a new future by filtering the value of the current future with a predicate.
If the current future contains a value which satisfies the predicate, the new future will also hold that value.
Otherwise, the resulting future will fail with a EmptyError.
If the current future fails, then the resulting future also fails.
Creates a new Future by applying the specified function to the result of this Future.
If there is any non-fatal exception thrown when 'block' is applied then that exception will be propagated to the resulting future.