Future.withCancel

Future!T withCancel(CancelToken token) @trusted

Attach an external cancellation token to this future.

If the token is already cancelled, the returned future is cancelled immediately. Otherwise, the returned future mirrors this future's result (resolve, reject, or cancel) unless the token fires first, in which case the returned future is cancelled.

Parameters

tokenExternal cancellation token to observe.

Returns

A new Future!T that can be cancelled via token.