Implementation of Cats type classes for the CancelableFuture data type.
Builder for a CancelableFuture.
Builder for a CancelableFuture.
is an underlying Future
reference that will respond to onComplete
calls
is a Cancelable that can be used to cancel the active computation
Given a registration function that can execute an asynchronous process, executes it and builds a CancelableFuture value out of it.
Given a registration function that can execute an asynchronous process, executes it and builds a CancelableFuture value out of it.
The given registration
function can return a Cancelable
reference that can be used to cancel the executed async process.
This reference can be empty.
def delayedResult[A](f: => A)(implicit s: Scheduler): CancelableFuture[A] = CancelableFuture.async { complete => val task = s.scheduleOnce(10.seconds) { complete(Try(f)) } Cancelable { () => println("Cancelling!") task.cancel() } }
This is much like working with Scala's Promise, only safer.
Returns the associated Cats type class instances for the CancelableFuture data type.
Returns the associated Cats type class instances for the CancelableFuture data type.
is the
ExecutionContext
needed in order to create the needed type class instances,
since future transformations rely on an ExecutionContext
passed explicitly (by means of an implicit parameter)
on each operation
Promotes a strict Throwable
to a CancelableFuture that's
already complete with a failure.
Promotes a strict Throwable
to a CancelableFuture that's
already complete with a failure.
is the error that's going to be signaled in the
onComplete
callback.
Promotes a strict Try[A]
to a CancelableFuture that's
already complete.
Promotes a strict Try[A]
to a CancelableFuture that's
already complete.
is the Try[A]
value that's going to be signaled
in the onComplete
callback.
Returns a CancelableFuture instance that will never complete.
Promotes a strict value
to a CancelableFuture that's
already complete.
Promotes a strict value
to a CancelableFuture that's
already complete.
Alias for successful.
is the value that's going to be signaled in the
onComplete
callback.
Promotes a strict Throwable
to a CancelableFuture that's
already complete with a failure.
Promotes a strict Throwable
to a CancelableFuture that's
already complete with a failure.
Alias for failed.
is the error that's going to be signaled in the
onComplete
callback.
Promotes a strict value
to a CancelableFuture that's
already complete.
Promotes a strict value
to a CancelableFuture that's
already complete.
is the value that's going to be signaled in the
onComplete
callback.
An already completed CancelableFuture.