abstract classCallback[-A] extends Listener[A] with (Try[A]) ⇒ Unit
Represents a callback that should be called asynchronously
with the result of a computation. Used by Task to signal
the completion of asynchronous computations on runAsync.
The onSuccess method should be called only once, with the successful
result, whereas onError should be called if the result is an error.
Obviously Callback describes unsafe side-effects, a fact that is
highlighted by the usage of Unit as the return type. Obviously
callbacks are unsafe to use in pure code, but are necessary for
describing asynchronous processes, like in Task.create.
Represents a callback that should be called asynchronously with the result of a computation. Used by Task to signal the completion of asynchronous computations on
runAsync
.The
onSuccess
method should be called only once, with the successful result, whereasonError
should be called if the result is an error.Obviously
Callback
describes unsafe side-effects, a fact that is highlighted by the usage ofUnit
as the return type. Obviously callbacks are unsafe to use in pure code, but are necessary for describing asynchronous processes, like in Task.create.