abstract
class
Callback[-E, -A] extends (Either[E, A]) ⇒ Unit
Instance Constructors
-
new
Callback()
Abstract Value Members
-
abstract
def
onError(e: E): Unit
-
abstract
def
onSuccess(value: A): Unit
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
def
andThen[A](g: (Unit) ⇒ A): (Either[E, A]) ⇒ A
-
def
apply(result: Try[A])(implicit ev: <:<[Throwable, E]): Unit
-
def
apply(result: Either[E, A]): Unit
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
def
compose[A](g: (A) ⇒ Either[E, A]): (A) ⇒ Unit
-
def
contramap[B](f: (B) ⇒ A): Callback[E, B]
-
-
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Represents a callback that should be called asynchronously with the result of a computation.
This is an
Either[E, A] => Unit
with an OOP interface that avoids extra boxing, along with overloads ofapply
.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.